package hihocoder;
import java.math.BigInteger;
import java.util.Scanner;

/**
 * 
 */

/**
 * @author zhongfang
 *
 */
public class 古老数字 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		String num=scanner.nextLine();
		String next=scanner.nextLine();
		String[] strs=next.split(" ");
		BigInteger xinteger=new BigInteger(strs[0]);
		BigInteger yInteger=new BigInteger(strs[1]);
		for (int i = 0; i < 10; i++) {
			char iChar=(char) (i+'0');
			String curNum=num.replace('?',iChar);
			BigInteger bigInteger=new BigInteger(curNum);
			if(bigInteger.mod(xinteger).equals(yInteger)){
				System.out.println(curNum);
				return;
			}
		}
		System.out.println("No solution");
	}

}
